using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vkIPrcptMap : EntityTypeConfiguration<vkIPrcpt>
    {
        public vkIPrcptMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Receipt_Date, t.Quantity, t.FOB_Cost, t.Invoice_Number, t.Landed_Cost, t.Shipped_Cost, t.Retail_Price, t.Total_Item_FOB_Cost });

            // Properties
            this.Property(t => t.Location)
                .HasMaxLength(20);

            this.Property(t => t.Purchase_Currency)
                .HasMaxLength(20);

            this.Property(t => t.Item_Number)
                .HasMaxLength(10);

            this.Property(t => t.Order_Number)
                .HasMaxLength(10);

            this.Property(t => t.Invoice_Number)
                .IsRequired()
                .HasMaxLength(7);

            this.Property(t => t.Color)
                .HasMaxLength(6);

            this.Property(t => t.Size)
                .HasMaxLength(6);

            this.Property(t => t.Vendor_Name)
                .HasMaxLength(35);

            this.Property(t => t.Receipt_Type)
                .HasMaxLength(1);

            this.Property(t => t.Expiry_Date)
                .HasMaxLength(6);

            this.Property(t => t.Manufacture_Code)
                .HasMaxLength(15);

            this.Property(t => t.Item_Category)
                .HasMaxLength(50);

            this.Property(t => t.Item_Type)
                .HasMaxLength(25);

            this.Property(t => t.Division)
                .HasMaxLength(30);

            // Table & Column Mappings
            this.ToTable("vkIPrcpts");
            this.Property(t => t.Location).HasColumnName("Location");
            this.Property(t => t.Purchase_Currency).HasColumnName("Purchase Currency");
            this.Property(t => t.Total_Overhead_Cost).HasColumnName("Total Overhead Cost");
            this.Property(t => t.Total_Shipment_Cost).HasColumnName("Total Shipment Cost");
            this.Property(t => t.Total_Receipt_Discount).HasColumnName("Total Receipt Discount");
            this.Property(t => t.Retail_Sale_Margin).HasColumnName("Retail Sale Margin");
            this.Property(t => t.Whole_Sale_Margin).HasColumnName("Whole Sale Margin");
            this.Property(t => t.Receipt_Date).HasColumnName("Receipt Date");
            this.Property(t => t.Item_Number).HasColumnName("Item Number");
            this.Property(t => t.Order_Number).HasColumnName("Order Number");
            this.Property(t => t.Quantity).HasColumnName("Quantity");
            this.Property(t => t.FOB_Cost).HasColumnName("FOB Cost");
            this.Property(t => t.FACTOR).HasColumnName("FACTOR");
            this.Property(t => t.POSTED).HasColumnName("POSTED");
            this.Property(t => t.Invoice_Number).HasColumnName("Invoice Number");
            this.Property(t => t.Landed_Cost).HasColumnName("Landed Cost");
            this.Property(t => t.Shipped_Cost).HasColumnName("Shipped Cost");
            this.Property(t => t.Color).HasColumnName("Color");
            this.Property(t => t.Size).HasColumnName("Size");
            this.Property(t => t.Retail_Price).HasColumnName("Retail Price");
            this.Property(t => t.Whole_Price).HasColumnName("Whole Price");
            this.Property(t => t.DISCOUNT).HasColumnName("DISCOUNT");
            this.Property(t => t.Discount_Percentage).HasColumnName("Discount Percentage");
            this.Property(t => t.Vendor_Name).HasColumnName("Vendor Name");
            this.Property(t => t.Receipt_Type).HasColumnName("Receipt Type");
            this.Property(t => t.Total_Item_FOB_Cost).HasColumnName("Total Item FOB Cost");
            this.Property(t => t.Expiry_Date).HasColumnName("Expiry Date");
            this.Property(t => t.Manufacture_Code).HasColumnName("Manufacture Code");
            this.Property(t => t.Item_Category).HasColumnName("Item Category");
            this.Property(t => t.Item_Type).HasColumnName("Item Type");
            this.Property(t => t.Cost).HasColumnName("Cost");
            this.Property(t => t.Total_Recipt_FOB_Cost).HasColumnName("Total Recipt FOB Cost");
            this.Property(t => t.Division).HasColumnName("Division");
            this.Property(t => t.Total_Receipt_Cost).HasColumnName("Total Receipt Cost");
            this.Property(t => t.Percentage_Receipt_Discount).HasColumnName("Percentage Receipt Discount");
        }
    }
}
